import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;


public class calc {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String input = "";
		String operator = "";
		Double num1;
		Double num2;
		Double answer = 0.0;
		Map<String, String> variables;
		variables = new HashMap<String, String>();
		while(true){
			try{
				input = br.readLine();
				String[] equation = input.split(" ");
				operator = equation[1];

				if(operator.equals("=")){
					variables.put(equation[0], equation[2]);
				}
				else{
					if(variables.containsKey(equation[0])){
						equation[0] = variables.get(equation[0]);
					}
					if(variables.containsKey(equation[1])){
						equation[1] = variables.get(equation[1]);
					}
					if(variables.containsKey(equation[2])){
						equation[2] = variables.get(equation[2]);
					}
					num1 = Double.parseDouble(equation[0] + ".0");
					num2 = Double.parseDouble(equation[2] + ".0");
					operator = equation[1];

					if(operator.equals("+")){
						answer = add(num1, num2);
					}
					else if(operator.equals("-")){
						answer = subtract(num1, num2);
					}
					else if(operator.equals("*")){
						answer = multiply(num1, num2);
					}
					else if(operator.equals("/")){
						answer = divide(num1, num2);
					}
					if(!operator.equals("=")){
						System.out.println(answer);
					}
				}
			}catch(NumberFormatException e){
				System.out.println("Something is wrong, try again.");
			}
		}
	}

	public static Double add(Double num1, Double num2){
		Double answer = num1 + num2;
		return answer;
	}
	public static Double subtract(Double num1, Double num2){
		Double answer = num1 - num2;
		return answer;
	}
	public static Double multiply(Double  num1, Double num2){
		Double answer = num1 * num2;
		return answer;
	}
	public static Double divide(Double num1, Double num2){
		Double answer = num1 / num2;
		return answer;
	}

}
